home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / mus / misc / mod2midi3.lha / Mod2Midi / mod2midi.doc < prev    next >
Text File  |  1992-09-02  |  21KB  |  387 lines

  1. MOD2MIDI - What it does
  2. ----------------------
  3. MOD2MIDI is a program which converts music modules generated by Amiga
  4. tracker programs (MOD files) to general MIDI format 1 (MID files). It is
  5. menu-driven and if not "user-friendly", at least "user-polite". No
  6. temporary files are created at any stage, so it is ok to be run on a
  7. floppy drive (though a disk-cache utility or a fast drive are
  8. preferred.. in fact, the faster the computer the better). Some editting
  9. of the output MID file might be necessary, but next time there will be
  10. less editting to do as MOD2MIDI can remember previous settings.
  11.  
  12. Why convert MOD files to MID files?
  13. -----------------------------------
  14. Even though MOD files contain some music-instructions that cannot be
  15. represented in MID format, there are many reasons why it is desirable to
  16. have music in MID form rather than MOD form:
  17.     * Some sound cards cannot play MOD files, only MID files (eg. Ad
  18.      Lib)
  19.     * Top-of-the-range music editting programs do not handle MOD files,
  20.      but almost always handle MID files, or at least allow you to
  21.      convert from MID files.
  22.     * There exist programs to print out MID files as musical score. I
  23.      don't know of any which do the same for MOD files
  24.     * MID files tend to be much smaller than MOD files
  25.     * On some sound cards, MID files sound better than MOD files
  26.      (although on many others the converse is true)
  27.     * MID files are more portable, having a well-known format, and have
  28.      utilities on many different computers. MID files _ARE_ the industry
  29.      standard.
  30.     * MID files can be played on professional keyboards, allowing expert
  31.      recording/presentation of music
  32.     * Umm.. Microsoft Windows comes with a MID player but not a MOD
  33.      player, so you can play MID files as a background task (and insert
  34.      MID files into documents etc. etc.)
  35. Ok.. have I sold you on MOD->MID conversion yet?
  36.  
  37. How to use MOD2MIDI
  38. ------------------
  39. After starting up MOD2MIDI (I assume you know how to do that), you can
  40. select menus and commands by simply pressing a key. There are 3 menus:
  41.     * File menu (press "F"): commands to do with files
  42.     * Samples menu (press "S"): commands to do with samples
  43.     * Options menu (press "O"): commands to set simple configurations
  44.     * Help menu (press "H"): commands to do with help
  45. You can also use the cursor keys to select menus and commands, and then
  46. press <RETURN> to select that command.
  47.  
  48. The File Menu
  49. -------------
  50. The file menu consists of 4 commands:
  51.     * Destination MIDI file (press "D"): A dialogue box will appear and
  52.      ask you to enter the name of a MID file. After entering the full
  53.      name (including extension eg. TECHNO.MID) press <RETURN>. If the
  54.      file you entered already exists then you will be asked if it can be
  55.      overwritten.. press "Y" for yes or "N" for no.
  56.     * Source MOD file (press "S"): A dialogue box will appear similar to
  57.      the "Destination MIDI" one. Enter a filename then press <RETURN>.
  58.     * Convert (press "C"): This will convert the MOD file you entered to
  59.      the MID file you entered. I suggest before you do this step, use
  60.      the Sample menu to set samples to appropriate instruments.
  61.      Sometimes conversion takes a while - please be patient. If you get
  62.      an error message which says that you have too many different
  63.      instruments, then use the "Map samples" command to reduce the
  64.      number.
  65.     * Quit (press "Q"): Yep.. you quit MOD2MIDI if you choose this
  66.      command.
  67.  
  68. The Samples Menu
  69. ---------------
  70. The samples menu consists of 2 commands:
  71.     * Map samples (press "M"): There are many, many MOD samples on
  72.      computers around the world, so it is impossible to automatically
  73.      know which instrument is equivalent to which sample. You must tell
  74.      MOD2MIDI which instrument to use. Use the cursor keys and <RETURN>
  75.      to select a sample from the list that appears on the screen. It is
  76.      possible that the list will be longer than the screen and so you
  77.      will need to move off the bottom of the list (don't worry.. the
  78.      list will scroll upwards if it can). If you can't move off the
  79.      top/bottom of the list, you will hear a beep. Each sample may have
  80.      an asterisk "*" before it - this means that there is actual sample
  81.      data that corresponds to this sample - ignore any other samples..
  82.      they won't be converted (except in name only). Each sample will
  83.      have an instrument code to its right. If the code is prefixed by a
  84.      "D" then it is a percussion code. Anyway.. after selecting a
  85.      sample, a list of all of the available instruments will appear on
  86.      the screen (it is another scrolling menu). Select one and the
  87.      appropriate code will appear to the right of the chosen sample. If
  88.      you don't want to select anything from a menu, just press <ESCAPE>.
  89.      So when all samples have been given instruments (sometimes they
  90.      will already have an instrument code.. it is best to leave these
  91.      codes as they already have been matched with a sample's name) press
  92.      <ESCAPE>
  93.     * Transposing (press "T"): Even if you have matched a MOD sample
  94.      with a MIDI instrument there is no guarantee that each will play at
  95.      the same pitch. MOD samples tend to sound high, low, very low, or
  96.      slightly off pitch when both MOD and MIDI instruments play the same
  97.      note. The trick is to map MOD samples to a different note during
  98.      the conversion, so that there won't be any horrible musical
  99.      clashes. A good way to do this is to find a sample that maps
  100.      exactly to a MIDI instrument, and then get a MOD-editor and play
  101.      other samples, and compare those samples to the "true" sample. This
  102.      way you can find the number of semitones difference there are
  103.      between a MOD sample and its instrument equivalent. For example,
  104.      bass guitar samples are usually an octave lower (sometimes two)
  105.      than their actual note. As an octave is 12 semitones, if the guitar
  106.      sample is transposed down 12 semitones, it sounds ok. Another
  107.      example, chords are usually made up of 3 notes which are played
  108.      simulateously (major chords have part of them transposed up 4
  109.      semitones, and another part 7 semitones where minor chords have 3
  110.      and 7 semitone transposed parts). After selecting a MOD-sample from
  111.      the menu (the numbers on the right are the transpose values), you
  112.      can enter in its transposition. For a bass sample you might enter:
  113.           -12
  114.      then press <RETURN>, whereas for a major chord you might enter
  115.           0, 4, 7
  116.      then press <RETURN>, and for a bass major chord you might enter
  117.           -12, -8, -5
  118.      then press <RETURN> (note than -12+4=-8 etc.). During conversion,
  119.      these transpositions are applied and hopefully the MID-file won't
  120.      sound as if many musicians are playing using different scales. A
  121.      couple of things you need to watch out for: if one of the
  122.      transposition values is 0 then it must be the first value, also
  123.      don't transpose percussion instruments - it's not a good idea.
  124.     * Volume shift (press "V"): This is similar to transposing, but it
  125.      affects volume rather than pitch. MOD2MIDI alters volumes by
  126.      applying a formula to each volume in the MOD file. The formula is
  127.      simple: it takes the volume, then adds a number, then multiplies by
  128.      a number, then divides by a number. So all you have to do is supply
  129.      3 numbers, though when you come to change a volume formula you will
  130.      notice that MOD2MIDI has already given each sample a formula.
  131.      MOD2MIDI analyses each sample of the MOD file when you it reads in
  132.      the MOD file and based on this analysis allocates a formula to the
  133.      samples. Note that these formulae are not necessarily correct, they
  134.      are just MOD2MIDI's best guess, but most of the time they will
  135.      suffice. To set the formula yourself, choose a sample then enter
  136.      the three numbers for the formula respectively (as you do for
  137.      transposition amounts), eg. if you want to "add 1, multiply by 2,
  138.      then divide by 3" every volume for a particular sample, you would
  139.      enter:
  140.           1, 2, 3
  141.      the press <RETURN>. The last two numbers cannot be negative, and
  142.      last number cannot be 0.
  143.     * Save info (press "S"): Because it is nicer to have the computer
  144.      select instruments, transpositions and volume shifts for you than
  145.      having to look them up each time, MOD2MIDI keeps a list of "known"
  146.      mappings/transposes/volume-shifts from MOD-samples to MID-
  147.      instruments. Once you have selected a mapping using the "Map
  148.      samples", a transposition using "Transposing", or a volume shift
  149.      using "Volume shift" you can use this command to save a sample's
  150.      info to the info file. Just select the sample with the cursor keys
  151.      and <RETURN> and it is done. Press <ESCAPE> to leave this command.
  152.  
  153. The Options Menu
  154. ----------------
  155. There are 2 commands which allow you to set options:
  156.     * Drum channel (press "D"): As different software/soundcard/hardware
  157.      is by definition different, I decided that setting the drum channel
  158.      to 10 permanently (as I did in version 0.1) is a bit impolite. So
  159.      you can choose this option and enter the drum channel that you want
  160.      (though if you don't enter any drum channel, it will assume you
  161.      meant channel 10).
  162.     * Tempo type (press "T"): Hmmm.. the MOD format caught me out with
  163.      this one in version 0.1, and I didn't know what to do to fix it, so
  164.      hence this option. Some MOD-files use an old tempo convention and
  165.      the rest use a newer one. Some MOD-files don't convert at all well
  166.      if the wrong convention is used. Anyway, after selecting this
  167.      option press either "0" or "1" to select new or old conventions
  168.      respectively. Initially, the convention will be the old one. If
  169.      the MID file produced sounds like the timing is out of whack, try
  170.      changing the tempo type and then doing the conversion again.
  171.  
  172. The Help Menu
  173. -------------
  174. There is only 1 command in the help menu:
  175.     * About (press "A"): This displays some information about MOD2MIDI.
  176.      Press any key to make it go away.
  177. If you really wanted help.. print out this document and use it as a
  178. reference while you use MOD2MIDI. If you are still stuck, call up a
  179. friend who knows a bit about computers and ask them what to do (but you
  180. were going to do that anyway weren't you?).. it may help if they know
  181. something about music too. Maybe get in contact with a hacker-friend and
  182. a muso-friend. On the other hand, maybe it would be best to throw a
  183. party and invite all your friends around.
  184.  
  185. Command Line Parameters
  186. -----------------------
  187. When executing MOD2MIDI, you can put the two filenames on the command-
  188. line, eg.
  189.           MOD2MIDI headbang.mod techno.mid
  190. The first filename (you guessed it) is the MOD file, and the second is
  191. the MID file. If the MID-file already exists, then you will be asked if
  192. you really want to overwrite it.
  193.  
  194. Example Session
  195. ---------------
  196. Ok.. just incase everything I have said so far has gone over your head,
  197. here is the way that I use the program (and it works for me.. honest!):
  198.     * Run MOD2MIDI by typing "MOD2MIDI" at the command-line and press
  199.      <RETURN>
  200.     * Press "F" followed by "S" to choose the "Source MOD file" command.
  201.     * Enter the MOD file name (eg. headbang.mod) and press <RETURN>.
  202.     * Press "D" to choose the "Destination MIDI file" command.
  203.     * Enter the MID file name (eg. techno.mid) and press <RETURN>
  204.     * Press either: the right cursor key
  205.                 or: <ESCAPE> followed by "S"
  206.     * Press "M" to choose the "Map Samples" command.
  207. <<1>>
  208.     * Now use the up cursor key and the down cursor key to highlight a
  209.      sample, then press <RETURN> to select it. Remember, only the
  210.      samples with a "*" on the left-hand side are actually samples, the
  211.      rest are probably just advertising.
  212.     * Now use the up cursor key and the down cursor key to highlight an
  213.      instrument (you should be getting quite good at this now) then
  214.      press <RETURN> to select it. If the sample was percussion, you
  215.      should've selected a percussion instrument (the ones with a "D" on
  216.      the left).
  217.     * Go back to <<1>> and do these steps until you get sick of them, or
  218.      all of the proper samples have been allocated an instrument
  219.     * Press <ESCAPE> to quit from this command
  220.     * Press either: the left cursor key, or
  221.                     <ESCAPE> followed by "F"
  222.     * Press "C" to choose the "Convert" command.
  223.     * Wait for the disk to stop writing, and the cursor to reappear.
  224.     * Press "Q" to choose the "Quit" command.
  225. There should now be a file lying around called "techno.mid" or whatever
  226. you typed in. This is the MIDI equivalent of the MOD file.
  227.  
  228. The Instruments
  229. ---------------
  230. The list of MIDI instruments is kept in the text file "MOD2MIDI.ins".
  231. Each instrument on a separate line. The first 128 lines must hold the
  232. instruments 0 to 127. The lines after this hold the percussion
  233. instruments (no more than 128). All instruments should have a code as
  234. the first thing on the line. The code must consist of the letter "D"
  235. (only if it is a percussion instrument) followed by a number from 0 to
  236. 127. This file can be editted with a text editor to put in the
  237. instruments for your particular soundcard/computer/keyboard/software
  238. etc. The supplied instrument file contains the Soundblaster MIDI
  239. patches, if you are using a synth or a different sound card, then edit
  240. this file and insert the correct instruments for you.
  241.  
  242. The Info File
  243. -------------
  244. A list of default mappings and transpositions is kept in the text file
  245. "MOD2MIDI.map". This is maintained with the "Save info" command in the
  246. "Samples" menu, but it can also be editted with a text-editor. Each
  247. sample is on a separate line, and consists of the first word in the
  248. sample's name followed by 7 numbers, all separated by spaces. The first
  249. word is the sample's name (which comes right after any header (st-xx: or
  250. leading spaces) and has any intermediate spaces replaced by underbar
  251. characters. The first number is a mapping number, the next three numbers
  252. are transposition values (normally 0 0 0), and the last three are the
  253. volume-shift values (eg. 1 0 0). The mapping numbers range from 0 to
  254. 255. The numbers 0-127 correspond to the MIDI instruments 0-127, and the
  255. other mapping numbers are the percussion instrument codes plus 128
  256. (without the "D" infront of course). The transposition values hold
  257. either a set amount to transpose the instrument by (first transposition
  258. value) or a mapping to a chord (two or more non-zero numbers). Any 0
  259. transposition value must occur in the first position. The transposition
  260. values range -128 to 127, 0 to 127, and 1 to 127 respectively in the
  261. formula (volume + x) * y / z. Each line in the info file is in
  262. alphabetical order, and it would be a bad idea to put a sample in the
  263. wrong place.
  264.  
  265. All of the mapping/transpositions in the supplied "MOD2MIDI.map" file are
  266. for the soundblaster card (preferrably running windows). If none of the
  267. info applies to you, you can delete the file and replacing it with the
  268. "blank.map" file provided. It is probably better to note down some of
  269. the info in the given "MOD2MIDI.map", as even if mappings are wrong,
  270. transpose and volume-shift values will still apply.
  271.  
  272. What is this .mm file?
  273. ----------------------
  274. Because there are some times when you don't want to store information
  275. about a MOD file in the info file, a file with the same name as the MOD-
  276. file except with a .mm extension is created. This .mm file holds all of
  277. the information that you have entered about the MOD-file. It is
  278. automatically read in when you load the MOD file, and automatically
  279. saved when you quit. It is read in just before checking the info file
  280. (above), and so if you have added any new sample info that applies to
  281. that particular MOD-file it will be included. You can safely delete
  282. the .mm file, but it will come back next time you using that MOD-file. 
  283.  
  284. Notes on Conversion
  285. -------------------
  286. Firstly, the way the algorithm works, each different instrument is
  287. allocated a different channel (this makes later editting of the MID file
  288. _MUCH_ easier). As there are only 16 different channels this causes a
  289. bit of a problem when you have a MOD file with 31 different samples. All
  290. is not lost due to the nature of MOD files. Each percussion instrument
  291. can be put on the same channel (10), giving you unlimited percussion
  292. instruments but 15 channels for the other instruments. If the MOD file
  293. you are using has more than 15 completely different non-percussion
  294. samples then it is an unusual MOD file indeed, and you will need to give
  295. some of the non-percussion samples the same instrument.
  296.  
  297. There is also some ambiguity with regard to multiple notes of the same
  298. pitch on the same channel in the MIDI format. The MOD format can handle
  299. it if the notes are on different channels, but if they are the same
  300. sample then MOD2MIDI will map them to the same channel in MIDI format.
  301. Some MIDI players allow "overlapping" notes, some don't - I was going to
  302. automatically remove "overlapped" notes, but no MIDI-player that I have
  303. look at chucks a fit if they are in, so they are still there. Cross your
  304. fingers and everything should sound fine.
  305.  
  306. It seems that there is also ambiguity with the MOD format, and tempo can
  307. be interpretted two ways (I hope there aren't any more!). If your MID
  308. file sounds like it should be in a different tempo in places, try
  309. changing the "Tempo Type" Option (from the Options menu.. see above).
  310.  
  311. Even with automatic volume-shift allocation and checking of the info-
  312. file for previous samples you will occasionally meet a converted MID
  313. file that doesn't sound right (well.. with all of the different hardware
  314. and software around, what can you expect?). Also, some samples may not
  315. be recognised by MOD2MIDI and may need transposing otherwise the tune
  316. might sound horrible.. but as soon as you find correct details about any
  317. new sample, feed them back into MOD2MIDI so it can recognise them
  318. correctly next time.
  319.  
  320. Not all MOD effects can be reproduced in a MID file. Things that I have
  321. been able to reproduce include:
  322.     * Tempo (given that your MID player can handle a tempo-track)
  323.     * Note length (calculated from frequency, tempo, and # bytes in sample)
  324.     * Pattern Break
  325.     * Position Jump (well.. not really.. pretend its Pattern Break)
  326.     * Set Volume
  327.     * Note slides (slide up, slide down, slide to, fine-up, fine-down)
  328.      all implemented, but permanently in glissando mode (ie. not a
  329.      smooth slide).
  330.     * Arpeggio
  331.     * Volume Slides (and finevolume slides), but only if they occur at
  332.      the start of a note
  333.     * Set Sample Offset (actually retriggers the sample)
  334.     * Retrigger sample
  335.     * Cut sample
  336.     * Delay sample
  337.     * Pattern delay
  338. Effects that I have not been able to reproduce, or have ignored on the
  339. grounds that they are silly in a MID file are:
  340.     * Vibrato and Tremolo (not really possible to do nicely in a MID file)
  341.     * Position Jump (I have sort-of included it)
  342.     * Pattern Loop (dangerous.. can cause infinite loops.. MIDI doesn't
  343.      support loops so left it out)
  344.     * Set filter (an Amiga-only hardware effect)
  345.     * Set glissando (permanently on)
  346.     * Set vibrato/tremolo waveforms (no MIDI equivalent)
  347.     * Invert loop (*sigh* MIDI can't even come close to implementing
  348.      this one)
  349. Hmm.. looking back at what I have included, it seems that MOD2MIDI has
  350. more features than some MOD-file players I have seen! (Some MOD-file
  351. players are really bad.. but this might be because not many programmers
  352. know the MOD-format specification.)
  353.  
  354. Source Code
  355. -----------
  356. I am distributing the source code - in fact, so must you! If MOD2MIDI is
  357. placed on a publicly accessible medium (eg. BBS, FTP-site, Shareware
  358. vendor, etc.), then the source code must be there too. It must always be
  359. possible for the user to be able to modify this program. This allows
  360. multiple-platform distribution, allows everyone to add their little
  361. tweaks or use their favourite optimiser, and is even educational (if you
  362. can stand my code). It is legal to only possess the executable-code, but
  363. not to distribute only the executable. It is legal to distribute only
  364. the source code. For more information on the license, see the textfile
  365. also distributed with this package. Oh.. by the way.. if your computer
  366. crashes when running this program and you lose 3 years of hard work and
  367. gain a stomach ulser, don't blame me.. blame the power station, or the
  368. computer store, or your nextdoor neighbor. Details of who not to blame
  369. are also in the license.
  370.  
  371. The source code consists of three .c files and and two header files:
  372.     * MOD2MIDI.c - main program
  373.     * MOD2MIDI.h - header file for MOD2MIDI.c
  374.     * amigawin.c - amiga windowing system file
  375.     * textwin.c - text-windowing system I notched up because I didn't
  376.      have one, and because I wanted one for MOD2MIDI. Hence it's rather
  377.      incomplete.
  378.     * textwinc.c - same text-windowing system as textwin.c, but runs
  379.      with the "curses" system. As curses is rather machine-independent,
  380.      this allows MOD2MIDI to be recompiled for just about any computer.
  381.     * textwin.h - header file for textwin.c
  382. If you are creating an executable, make sure you link textwin with
  383. MOD2MIDI. MOD2MIDI was compiled on Turbo C 2.0, though it should work on
  384. any ANSI C compiler (if it's not an MSDOS gizmo, use textwinc.c instead
  385. of textwin.c)
  386.  
  387.